package main

import "fmt"

type Hero struct {
	Name  string
	Age   int
	Level int
}

func (this *Hero) Show() {
	fmt.Println("Name:", this.Name, " Age:", this.Age, " Level:", this.Level)
}

func (this *Hero) GetName() string {
	return this.Name
}

func (this *Hero) SetName(newName string) {
	// this是调用该方法的对象的一个副本（拷贝）
	this.Name = newName
}

func main() {
	hero := Hero{Name: "曾皓杰", Age: 18, Level: 1}
	hero1 := Hero{"曾皓杰", 181, 1}
	hero.Show()
	hero.SetName("xxx")
	hero.Show()
	hero1.Show()
}
